package com.itwn.comic.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.itwn.comic.entity.Section;
import com.itwn.comic.mapper.SectionMapper;
import com.itwn.comic.vo.ResourceVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SectionService {
    @Autowired
    SectionMapper sectionMapper;

    public int addSection(Section section) {
        return sectionMapper.insert(section);
    }

    public int modifySection(Section section) {
        return sectionMapper.updateByPrimaryKey(section);
    }

    public int removeSectionById(int id) {
        return sectionMapper.deleteByPrimaryKey(id);
    }

    public PageInfo<Section> querySectionByPage(Integer size, Integer now,Integer id) {
        PageHelper.startPage(now,size);
        List<Section> list = sectionMapper.selectAllByTime(id);
        return new PageInfo<>(list);
    }
}
